<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>v-model指令</title>
</head>
<body>
<div id="app">
    <input type="button" value="修改" @click="setMsg">
    <input type="text" v-model="message" @keyup.enter="getMsg">
    <h2>{{message}}</h2>
</div>

<!-- 生产环境版本，优化了尺寸和速度 -->
<script src="https://cdn.jsdelivr.net/npm/vue"></script>
<script type="text/javascript">
    var vue = new Vue({
        el: "#app",
        data: {
            message: "打个招呼吧! hi vue。"
        },
        methods: {
            getMsg:function () {
                alert(this.message)
            },
            setMsg:function () {
                this.message="hi itzhouyu!"
            }
        }
    })
</script>
</body>
</html>
